package com.example.springmvc.service.impl;

import com.example.springmvc.mapper.ItemMapper;
import com.example.springmvc.pojo.Item;
import com.example.springmvc.service.IItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("itemService")
public class ItemServiceImpl implements IItemService
{

    @Autowired
    private ItemMapper itemMapper;

    @Override
    public List<Item> queryItemList()
    {
        return itemMapper.selectByExample(null);
    }

    @Override
    public Item queryItemById(int id)
    {
        return itemMapper.selectByPrimaryKey(id);
    }

    @Override
    public void updateItemById(Item item) {
        itemMapper.updateByPrimaryKeySelective(item);

    }
}
